package com.inspectortime.service;

public final class ZipCodeUtils {
	
	private ZipCodeUtils() {}
	
	public static double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
		double radiusOfEarth = 3963.0;
		double decimalToRadiansConstant = 57.2958;		
		double distance = radiusOfEarth * Math.acos(Math.sin(lat1/decimalToRadiansConstant) * Math.sin(lat2/decimalToRadiansConstant) + Math.cos(lat1/decimalToRadiansConstant) * Math.cos(lat2/decimalToRadiansConstant) * Math.cos(lon2/decimalToRadiansConstant - lon1/decimalToRadiansConstant));
		return distance;
	}

}
